/*
 * @Description: 文件描述
 * @Author: 陈三愿
 * @Date: 2025-09-15 00:32:54
 * @LastEditTime: 2025-09-15 00:53:27
 */
import { resolve } from "path";
export default defineNuxtConfig({
  compatibilityDate: "2025-07-15",
  devtools: { enabled: true },
  css: [
    resolve(__dirname, "./assets/css/tailwind.css"),
    "element-plus/dist/index.css",
    resolve(__dirname, "./assets/css/element-overrides.css"),
  ],
  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  },
  vite: {
    esbuild: {
      jsx: "automatic",
      jsxFactory: "h",
      jsxFragment: "Fragment",
    },
  },
  build: {
    babel: {
      presets: ["@babel/preset-env"],
      plugins: ["@vue/babel-plugin-jsx"],
    },
    transpile: ["element-plus/es"],
  },
  generate: {
    routes: ["/form"],
  },
  app: {
    head: {
      script: [
        {
          innerHTML: `
            (function() {
              try {
                const savedTheme = localStorage.getItem('theme') || 'light';
                document.documentElement.setAttribute('data-theme', savedTheme);
                document.documentElement.classList.add('theme-initialized');
              } catch (e) {
                console.error('无法设置初始主题:', e);
              }
            })();
          `,
          type: "text/javascript",
          tagPriority: "high",
        },
      ],
    },
  },
});
